/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lvoddownloader;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import javax.swing.ImageIcon;
import javax.swing.JSlider;
import javax.swing.plaf.basic.BasicSliderUI;

/**
 *
 * @author wcss
 */
public class LProgressSliderUI extends BasicSliderUI {

    public LProgressSliderUI(JSlider b) {
        super(b);
    }

    /**
     *
     */
    /**
     * 绘制指示物
     */
    public void paintThumb(Graphics g) 
    {
        Graphics2D g2d = (Graphics2D) g;
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        //也可以帖图(利用鼠标事件转换image即可体现不同状态)
        g2d.clearRect(0, 0, (int)g.getClipBounds().getWidth(), (int)g.getClipBounds().getHeight());
        g2d.setColor(new java.awt.Color(51, 51, 51));
        g2d.fillRect(0, 0, (int)g.getClipBounds().getWidth(), (int)g.getClipBounds().getHeight());
        ImageIcon flag = new ImageIcon(LVolumeSliderUI.class.getResource("/UIImages/Speed/dot-2.png"));
        ImageIcon bg = new ImageIcon(LVolumeSliderUI.class.getResource("/UIImages/Speed/bg-1.png"));
        ImageIcon progress = new ImageIcon(LVolumeSliderUI.class.getResource("/UIImages/Speed/bg-2.png"));
        ImageIcon back = new ImageIcon(LVolumeSliderUI.class.getResource("/UIImages/playerbgs/progressbar_bg.JPG"));
        g2d.drawImage(back.getImage(),0, 0, (int)g.getClipBounds().getWidth(), (int)g.getClipBounds().getHeight(),null);
        g2d.drawImage(bg.getImage(), 0,thumbRect.y + 5, (int)g.getClipBounds().getWidth(),7,null);
        g2d.drawImage(progress.getImage(), 0,thumbRect.y + 5, thumbRect.x + 8,7,null);
        g2d.drawImage(flag.getImage(), thumbRect.x, thumbRect.y, 16,16,null);
    }

    /**
     *
     */
    /**
     * 绘制刻度轨迹
     */
    public void paintTrack(Graphics g) 
    {
        //super.paintTrack(g);
    }
}
